package com.ssy.lingxi.product.repository.commodity;

import com.ssy.lingxi.product.entity.commodity.member.CommodityUnitPriceStrategy;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * 商品价格策略持久化层
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/1/11
 */
public interface CommodityUnitPriceStrategyRepository extends JpaRepository<CommodityUnitPriceStrategy,Long>, JpaSpecificationExecutor<CommodityUnitPriceStrategy> {
    Boolean existsByNameAndIdNotAndMemberIdAndMemberRoleId(String name, Long id, Long memberId, Long memberRoleId);

    Boolean existsByNameAndMemberIdAndMemberRoleId(String name, Long memberId, Long memberRoleId);

    Boolean existsByIdNotAndShopIdAndMemberUnitPriceListCommodityUnitPriceIdInAndIsMember(Long id, Long shopId, List<Long> commodityUnitPriceIdList, Boolean isMember);

    Boolean existsByShopIdAndMemberUnitPriceListCommodityUnitPriceIdInAndIsMember(Long shopId, List<Long> commodityUnitPriceIdList, Boolean isMember);

    Boolean existsByIdNotAndShopIdAndMemberUnitPriceListCommodityUnitPriceIdInAndIsMemberAndApplyTypeAndCommodityMemberListMemberIdInAndCommodityMemberListMemberRoleIdIn(Long id, Long shopId, List<Long> commodityUnitPriceIdList, boolean b, Integer applyType, List<Long> memberIdList, List<Long> memberRoleIdList);

    Boolean existsByIdNotAndShopIdAndMemberUnitPriceListCommodityUnitPriceIdInAndIsMemberAndApplyTypeAndCommodityMemberLevelListLevelInAndCommodityMemberLevelListMemberRoleIdIn(Long id, Long shopId, List<Long> commodityUnitPriceIdList, boolean b, Integer applyType, List<Integer> memberLevelList, List<Long> memberRoleIdList);

    Boolean existsByShopIdAndMemberUnitPriceListCommodityUnitPriceIdInAndIsMemberAndApplyTypeAndCommodityMemberListMemberIdInAndCommodityMemberListMemberRoleIdIn(Long shopId, List<Long> commodityUnitPriceIdList, boolean b, Integer applyType, List<Long> memberIdList, List<Long> memberRoleIdList);

    Boolean existsByShopIdAndMemberUnitPriceListCommodityUnitPriceIdInAndIsMemberAndApplyTypeAndCommodityMemberLevelListLevelInAndCommodityMemberLevelListMemberRoleIdIn(Long shopId, List<Long> commodityUnitPriceIdList, boolean b, Integer applyType, List<Integer> memberLevelList, List<Long> memberRoleIdList);
}
